from presenter import basepresenter

class DiscussionTopicsPresenter(basepresenter.BasePresenter):

    def respondToGet(self):
        #get the topics for the discussion
        if (self.request.get('discussion')):
            thediscussion = self.discussiontask.getDiscussionByKey(self.request.get('discussion'))
            self.template_values['discussion'] = thediscussion.title
            heading = thediscussion.title
            self.template_values['heading'] = heading
            self.template_values['discussionkey'] = self.request.get('discussion')
            self.template_values['discussion'] = thediscussion
            topics = self.discussiontask.getTopicsByDiscussion(thediscussion)

        self.template_values['topics'] = topics

        # set up the page title
        page_title = self.sitetitle + ' - Discussion - ' + thediscussion.type + ' - ' + heading
        self.template_values['page_title'] = page_title

        #get the view to draw the page
        self.view.showGetResponse(self.template_values)